package com.ssy.lingxi.member.merchant.controller.web;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.member.merchant.model.vo.basic.response.AuthTreeMenuButtonCheckIdVO;
import com.ssy.lingxi.member.merchant.model.vo.basic.response.AuthTreeMenuVO;
import com.ssy.lingxi.member.merchant.model.vo.maintenance.response.PlatformMemberQuerySearchConditionVO;
import com.ssy.lingxi.member.merchant.model.vo.maintenance.response.PlatformPageQueryMemberVO;
import com.ssy.lingxi.member.merchant.model.vo.validate.request.*;
import com.ssy.lingxi.member.merchant.model.vo.validate.response.PlatformMemberValidateDetailVO;
import com.ssy.lingxi.member.merchant.model.vo.validate.response.PlatformMemberValidateQueryButtonVO;
import com.ssy.lingxi.member.merchant.service.web.IPlatformMemberValidateService;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @menu 平台后台 - 平台会员管理 - 会员审核接口
 * @author 万宁
 * @version 2.0.0
 * @date 2020-06-28
 */
@RestController
@RequestMapping("/member/validate")
public class PlatformMemberValidateController {

    @Resource
    private IPlatformMemberValidateService memberVerifyService;

    /**
     * 获取“待提交审核会员”页面中各个查询条件下拉选择框的内容
     * @param headers HttpHeaders信息
     * @return 操作结果
     */
    @RequestMapping(value = "/commit/pageitems", method = RequestMethod.GET)
    public Wrapper<PlatformMemberQuerySearchConditionVO> getToBeCommitPageCondition(@RequestHeader HttpHeaders headers) {
        return memberVerifyService.getToBeCommitPageCondition(headers);
    }

    /**
     * 分页查询“待提交审核会员”列表
     * @param headers Http头部信息
     * @param memberQueryVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/commit/page", method = RequestMethod.GET)
    public Wrapper<PageData<PlatformPageQueryMemberVO>> pageToBeCommitMembers(@RequestHeader HttpHeaders headers, @Valid PlatformMemberValidateQueryVO memberQueryVO) {
        return memberVerifyService.pageToBeCommitMembers(headers, memberQueryVO);
    }

    /**
     * 获取“提交审核会员”页面会员信息
     * @param headers Http头部信息
     * @param validateVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/commit/detail", method = RequestMethod.GET)
    public Wrapper<PlatformMemberValidateDetailVO> getToBeCommitMemberDetail(@RequestHeader HttpHeaders headers, @Valid MemberValidateVO validateVO) {
        return memberVerifyService.getToBeCommitMemberDetail(headers, validateVO);
    }

    /**
     * 获得左侧全量菜单
     * @param headers Http头部信息
     * @param validateVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/tree", method = RequestMethod.GET)
    public Wrapper<List<AuthTreeMenuVO>> getTreeAuthMenu(@RequestHeader HttpHeaders headers, @Valid MemberValidateVO validateVO) {
        return memberVerifyService.getTreeAuthMenu(headers, validateVO);
    }

    /**
     * 获得左侧菜单勾选的Id列表
     * @param headers Http头部信息
     * @param validateVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/tree/checkids", method = RequestMethod.GET)
    public Wrapper<AuthTreeMenuButtonCheckIdVO> getValidateAuthTreeCheckIds(@RequestHeader HttpHeaders headers, @Valid MemberValidateVO validateVO) {
        return memberVerifyService.getValidateAuthTreeCheckIds(headers, validateVO);
    }

    /**
     * 点击左侧权限菜单，获得右侧按钮列表，以及需要勾选的按钮id列表
     * @param headers Http头部信息
     * @param buttonVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/commit/getbutton", method = RequestMethod.GET)
    public Wrapper<PlatformMemberValidateQueryButtonVO> getTreeAuthButtons(@RequestHeader HttpHeaders headers, @Valid MemberValidateButtonVO buttonVO) {
        return memberVerifyService.getTreeAuthButtons(headers, buttonVO);
    }

    /**
     * 修改审核会员的左侧菜单权限
     * @param headers Http头部信息
     * @param authVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/commit/updatemenu")
    public Wrapper<Void> updateValidateAuth(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberValidateUpdateAuthVO authVO) {
        return memberVerifyService.updateValidateAuth(headers, authVO);
    }

    /**
     * 修改审核会员的右侧按钮权限
     * @param headers Http头部信息
     * @param buttonVO 接口参数
     * @return 操作结果
     */
    @RequestMapping("/commit/updatebutton")
    public Wrapper<Void> updateValidateAuthButton(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberValidateUpdateAuthButtonVO buttonVO) {
        return memberVerifyService.updateValidateAuthButton(headers, buttonVO);
    }

    /**
     * 提交审核会员
     * @param headers Http头部信息
     * @param commitVO 接口参数
     * @return 操作结果
     */
    @RequestMapping("/commit/submit")
    public Wrapper<Void> commitMemberValidate(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberValidateCommitVO commitVO) {
        return memberVerifyService.commitMemberValidate(headers, commitVO);
    }

    /**
     * 批量提交审核会员
     * @param headers Http头部信息
     * @param validateVOList 接口参数
     * @return 操作结果
     */
    @RequestMapping("/commit/batch")
    public Wrapper<Void> batchCommitMemberValidate(@RequestHeader HttpHeaders headers, @RequestBody @Valid List<MemberValidateVO> validateVOList) {
        return memberVerifyService.batchCommitMemberValidate(headers, validateVOList);
    }


    /**
     * 获取“待审核会员(一级)”页面中各个查询条件下拉选择框的内容
     * @param headers Http头部信息
     * @return 操作结果
     */
    @RequestMapping(value = "/step1/pageitems", method = RequestMethod.GET)
    public Wrapper<PlatformMemberQuerySearchConditionVO> getToBeValidateStep1PageCondition(@RequestHeader HttpHeaders headers) {
        return memberVerifyService.getToBeValidateStep1PageCondition(headers);
    }

    /**
     * 分页查询“待审核会员(一级)”列表
     * @param headers Http头部信息
     * @param memberQueryVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/step1/page", method = RequestMethod.GET)
    public Wrapper<PageData<PlatformPageQueryMemberVO>> pageToBeValidateStep1Members(@RequestHeader HttpHeaders headers, @Valid PlatformMemberValidateQueryVO memberQueryVO) {
        return memberVerifyService.pageToBeValidateStep1Members(headers, memberQueryVO);
    }

    /**
     * 获取“审核会员(一级)”页面会员信息
     * @param headers Http头部信息
     * @param validateVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/step1/detail", method = RequestMethod.GET)
    public Wrapper<PlatformMemberValidateDetailVO> getValidateStep1MemberDetail(@RequestHeader HttpHeaders headers, @Valid MemberValidateVO validateVO) {
        return memberVerifyService.getValidateStep1MemberDetail(headers, validateVO);
    }

    /**
     * 审核会员(一级)
     * @param headers Http头部信息
     * @param commitVO 接口参数
     * @return 操作结果
     */
    @RequestMapping("/step1/submit")
    public Wrapper<Void> validateMemberStep1(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberValidateCommitVO commitVO) {
        return memberVerifyService.validateMemberStep1(headers, commitVO);
    }

    /**
     * 批量审核会员(一级)
     * @param headers Http头部信息
     * @param validateVOList 接口参数
     * @return 操作结果
     */
    @RequestMapping("/step1/batch")
    public Wrapper<Void> batchValidateMemberStep1(@RequestHeader HttpHeaders headers, @RequestBody @Valid List<MemberValidateVO> validateVOList) {
        return memberVerifyService.batchValidateMemberStep1(headers, validateVOList);
    }

    /**
     * 获取“待审核会员(二级)”页面中各个查询条件下拉选择框的内容
     * @param headers Http头部信息
     * @return 操作结果
     */
    @RequestMapping(value = "/step2/pageitems", method = RequestMethod.GET)
    public Wrapper<PlatformMemberQuerySearchConditionVO> getToBeValidateStep2PageCondition(@RequestHeader HttpHeaders headers) {
        return memberVerifyService.getToBeValidateStep2PageCondition(headers);
    }

    /**
     * 分页查询“待审核会员(二级)”列表
     * @param headers Http头部信息
     * @param memberQueryVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/step2/page", method = RequestMethod.GET)
    public Wrapper<PageData<PlatformPageQueryMemberVO>> pageToBeValidateStep2Members(@RequestHeader HttpHeaders headers, @Valid PlatformMemberValidateQueryVO memberQueryVO) {
        return memberVerifyService.pageToBeValidateStep2Members(headers, memberQueryVO);
    }

    /**
     * 获取“审核会员(二级)”页面会员信息
     * @param headers Http头部信息
     * @param validateVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/step2/detail", method = RequestMethod.GET)
    public Wrapper<PlatformMemberValidateDetailVO> getValidateStep2MemberDetail(@RequestHeader HttpHeaders headers, @Valid MemberValidateVO validateVO) {
        return memberVerifyService.getValidateStep2MemberDetail(headers, validateVO);
    }

    /**
     * 审核会员(二级)
     * @param headers Http头部信息
     * @param commitVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/step2/submit")
    public Wrapper<Void> validateMemberStep2(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberValidateCommitVO commitVO) {
        return memberVerifyService.validateMemberStep2(headers, commitVO);
    }

    /**
     * 批量审核会员(二级)
     * @param headers Http头部信息
     * @param validateVOList 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/step2/batch")
    public Wrapper<Void> batchValidateMemberStep2(@RequestHeader HttpHeaders headers, @RequestBody @Valid List<MemberValidateVO> validateVOList) {
        return memberVerifyService.batchValidateMemberStep2(headers, validateVOList);
    }

    /**
     * 获取“待确认会员审核结果”页面中各个查询条件下拉选择框的内容
     * @param headers Http头部信息
     * @return 操作结果
     */
    @RequestMapping(value = "/confirm/pageitems", method = RequestMethod.GET)
    public Wrapper<PlatformMemberQuerySearchConditionVO> getToBeConfirmPageCondition(@RequestHeader HttpHeaders headers) {
        return memberVerifyService.getToBeConfirmPageCondition(headers);
    }

    /**
     * 分页查询“待确认会员审核结果”列表
     * @param headers Http头部信息
     * @param memberQueryVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/confirm/page", method = RequestMethod.GET)
    public Wrapper<PageData<PlatformPageQueryMemberVO>> pageToBeConfirmMembers(@RequestHeader HttpHeaders headers, @Valid PlatformMemberValidateQueryVO memberQueryVO) {
        return memberVerifyService.pageToBeConfirmMembers(headers, memberQueryVO);
    }


    /**
     * 获取“确认会员审核结果”页面会员信息
     * @param headers Http头部信息
     * @param validateVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/confirm/detail", method = RequestMethod.GET)
    public Wrapper<PlatformMemberValidateDetailVO> getConfirmValidateMemberDetail(@RequestHeader HttpHeaders headers, @Valid MemberValidateVO validateVO) {
        return memberVerifyService.getConfirmValidateMemberDetail(headers, validateVO);
    }

    /**
     * 确认会员审核结果
     * @param headers Http头部信息
     * @param commitVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/confirm/submit")
    public Wrapper<Void> confirmMemberValidate(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberValidateCommitVO commitVO) {
        return memberVerifyService.confirmMemberValidate(headers, commitVO);
    }

    /**
     * 批量确认会员审核结果
     * @param headers Http头部信息
     * @param validateVOList 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/confirm/batch")
    public Wrapper<Void> batchConfirmMemberValidate(@RequestHeader HttpHeaders headers, @RequestBody @Valid List<MemberValidateVO> validateVOList) {
        return memberVerifyService.batchConfirmMemberValidate(headers, validateVOList);
    }
}
